home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gtk-2.0 / gdk / gdkevents.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-25  |  13.3 KB  |  554 lines

  1. /* GDK - The GIMP Drawing Kit
  2.  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Lesser General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.
  8.  *
  9.  * This library is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.  * Lesser General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Lesser General Public
  15.  * License along with this library; if not, write to the
  16.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.  * Boston, MA 02111-1307, USA.
  18.  */
  19.  
  20. /*
  21.  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  22.  * file for a list of people on the GTK+ Team.  See the ChangeLog
  23.  * files for a list of changes.  These files are distributed with
  24.  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  25.  */
  26.  
  27. #ifndef __GDK_EVENTS_H__
  28. #define __GDK_EVENTS_H__
  29.  
  30. #include <gdk/gdkcolor.h>
  31. #include <gdk/gdktypes.h>
  32. #include <gdk/gdkdnd.h>
  33. #include <gdk/gdkinput.h>
  34.  
  35. G_BEGIN_DECLS
  36.  
  37. #define GDK_TYPE_EVENT          (gdk_event_get_type ())
  38.  
  39. #define GDK_PRIORITY_EVENTS    (G_PRIORITY_DEFAULT)
  40. #define GDK_PRIORITY_REDRAW     (G_PRIORITY_HIGH_IDLE + 20)
  41.  
  42.  
  43. typedef struct _GdkEventAny        GdkEventAny;
  44. typedef struct _GdkEventExpose        GdkEventExpose;
  45. typedef struct _GdkEventNoExpose    GdkEventNoExpose;
  46. typedef struct _GdkEventVisibility  GdkEventVisibility;
  47. typedef struct _GdkEventMotion        GdkEventMotion;
  48. typedef struct _GdkEventButton        GdkEventButton;
  49. typedef struct _GdkEventScroll      GdkEventScroll;  
  50. typedef struct _GdkEventKey        GdkEventKey;
  51. typedef struct _GdkEventFocus        GdkEventFocus;
  52. typedef struct _GdkEventCrossing    GdkEventCrossing;
  53. typedef struct _GdkEventConfigure   GdkEventConfigure;
  54. typedef struct _GdkEventProperty    GdkEventProperty;
  55. typedef struct _GdkEventSelection   GdkEventSelection;
  56. typedef struct _GdkEventOwnerChange GdkEventOwnerChange;
  57. typedef struct _GdkEventProximity   GdkEventProximity;
  58. typedef struct _GdkEventClient        GdkEventClient;
  59. typedef struct _GdkEventDND         GdkEventDND;
  60. typedef struct _GdkEventWindowState GdkEventWindowState;
  61. typedef struct _GdkEventSetting     GdkEventSetting;
  62. typedef struct _GdkEventGrabBroken  GdkEventGrabBroken;
  63.  
  64. typedef union  _GdkEvent        GdkEvent;
  65.  
  66. typedef void (*GdkEventFunc) (GdkEvent *event,
  67.                   gpointer    data);
  68.  
  69. /* Event filtering */
  70.  
  71. typedef void GdkXEvent;      /* Can be cast to window system specific
  72.                * even type, XEvent on X11, MSG on Win32.
  73.                */
  74.  
  75. typedef enum {
  76.   GDK_FILTER_CONTINUE,      /* Event not handled, continue processesing */
  77.   GDK_FILTER_TRANSLATE,      /* Native event translated into a GDK event and
  78.                              stored in the "event" structure that was
  79.                              passed in */
  80.   GDK_FILTER_REMOVE      /* Terminate processing, removing event */
  81. } GdkFilterReturn;
  82.  
  83. typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
  84.                       GdkEvent *event,
  85.                       gpointer  data);
  86.  
  87.  
  88. /* Event types.
  89.  *   Nothing: No event occurred.
  90.  *   Delete: A window delete event was sent by the window manager.
  91.  *         The specified window should be deleted.
  92.  *   Destroy: A window has been destroyed.
  93.  *   Expose: Part of a window has been uncovered.
  94.  *   NoExpose: Same as expose, but no expose event was generated.
  95.  *   VisibilityNotify: A window has become fully/partially/not obscured.
  96.  *   MotionNotify: The mouse has moved.
  97.  *   ButtonPress: A mouse button was pressed.
  98.  *   ButtonRelease: A mouse button was release.
  99.  *   KeyPress: A key was pressed.
  100.  *   KeyRelease: A key was released.
  101.  *   EnterNotify: A window was entered.
  102.  *   LeaveNotify: A window was exited.
  103.  *   FocusChange: The focus window has changed. (The focus window gets
  104.  *          keyboard events).
  105.  *   Resize: A window has been resized.
  106.  *   Map: A window has been mapped. (It is now visible on the screen).
  107.  *   Unmap: A window has been unmapped. (It is no longer visible on
  108.  *        the screen).
  109.  *   Scroll: A mouse wheel was scrolled either up or down.
  110.  */
  111. typedef enum
  112. {
  113.   GDK_NOTHING        = -1,
  114.   GDK_DELETE        = 0,
  115.   GDK_DESTROY        = 1,
  116.   GDK_EXPOSE        = 2,
  117.   GDK_MOTION_NOTIFY    = 3,
  118.   GDK_BUTTON_PRESS    = 4,
  119.   GDK_2BUTTON_PRESS    = 5,
  120.   GDK_3BUTTON_PRESS    = 6,
  121.   GDK_BUTTON_RELEASE    = 7,
  122.   GDK_KEY_PRESS        = 8,
  123.   GDK_KEY_RELEASE    = 9,
  124.   GDK_ENTER_NOTIFY    = 10,
  125.   GDK_LEAVE_NOTIFY    = 11,
  126.   GDK_FOCUS_CHANGE    = 12,
  127.   GDK_CONFIGURE        = 13,
  128.   GDK_MAP        = 14,
  129.   GDK_UNMAP        = 15,
  130.   GDK_PROPERTY_NOTIFY    = 16,
  131.   GDK_SELECTION_CLEAR    = 17,
  132.   GDK_SELECTION_REQUEST = 18,
  133.   GDK_SELECTION_NOTIFY    = 19,
  134.   GDK_PROXIMITY_IN    = 20,
  135.   GDK_PROXIMITY_OUT    = 21,
  136.   GDK_DRAG_ENTER        = 22,
  137.   GDK_DRAG_LEAVE        = 23,
  138.   GDK_DRAG_MOTION       = 24,
  139.   GDK_DRAG_STATUS       = 25,
  140.   GDK_DROP_START        = 26,
  141.   GDK_DROP_FINISHED     = 27,
  142.   GDK_CLIENT_EVENT    = 28,
  143.   GDK_VISIBILITY_NOTIFY = 29,
  144.   GDK_NO_EXPOSE        = 30,
  145.   GDK_SCROLL            = 31,
  146.   GDK_WINDOW_STATE      = 32,
  147.   GDK_SETTING           = 33,
  148.   GDK_OWNER_CHANGE      = 34,
  149.   GDK_GRAB_BROKEN       = 35
  150. } GdkEventType;
  151.  
  152. /* Event masks. (Used to select what types of events a window
  153.  *  will receive).
  154.  */
  155. typedef enum
  156. {
  157.   GDK_EXPOSURE_MASK        = 1 << 1,
  158.   GDK_POINTER_MOTION_MASK    = 1 << 2,
  159.   GDK_POINTER_MOTION_HINT_MASK    = 1 << 3,
  160.   GDK_BUTTON_MOTION_MASK    = 1 << 4,
  161.   GDK_BUTTON1_MOTION_MASK    = 1 << 5,
  162.   GDK_BUTTON2_MOTION_MASK    = 1 << 6,
  163.   GDK_BUTTON3_MOTION_MASK    = 1 << 7,
  164.   GDK_BUTTON_PRESS_MASK        = 1 << 8,
  165.   GDK_BUTTON_RELEASE_MASK    = 1 << 9,
  166.   GDK_KEY_PRESS_MASK        = 1 << 10,
  167.   GDK_KEY_RELEASE_MASK        = 1 << 11,
  168.   GDK_ENTER_NOTIFY_MASK        = 1 << 12,
  169.   GDK_LEAVE_NOTIFY_MASK        = 1 << 13,
  170.   GDK_FOCUS_CHANGE_MASK        = 1 << 14,
  171.   GDK_STRUCTURE_MASK        = 1 << 15,
  172.   GDK_PROPERTY_CHANGE_MASK    = 1 << 16,
  173.   GDK_VISIBILITY_NOTIFY_MASK    = 1 << 17,
  174.   GDK_PROXIMITY_IN_MASK        = 1 << 18,
  175.   GDK_PROXIMITY_OUT_MASK    = 1 << 19,
  176.   GDK_SUBSTRUCTURE_MASK        = 1 << 20,
  177.   GDK_SCROLL_MASK               = 1 << 21,
  178.   GDK_ALL_EVENTS_MASK        = 0x3FFFFE
  179. } GdkEventMask;
  180.  
  181. typedef enum
  182. {
  183.   GDK_VISIBILITY_UNOBSCURED,
  184.   GDK_VISIBILITY_PARTIAL,
  185.   GDK_VISIBILITY_FULLY_OBSCURED
  186. } GdkVisibilityState;
  187.  
  188. typedef enum
  189. {
  190.   GDK_SCROLL_UP,
  191.   GDK_SCROLL_DOWN,
  192.   GDK_SCROLL_LEFT,
  193.   GDK_SCROLL_RIGHT
  194. } GdkScrollDirection;
  195.  
  196. /* Types of enter/leave notifications.
  197.  *   Ancestor:
  198.  *   Virtual:
  199.  *   Inferior:
  200.  *   Nonlinear:
  201.  *   NonlinearVirtual:
  202.  *   Unknown: An unknown type of enter/leave event occurred.
  203.  */
  204. typedef enum
  205. {
  206.   GDK_NOTIFY_ANCESTOR        = 0,
  207.   GDK_NOTIFY_VIRTUAL        = 1,
  208.   GDK_NOTIFY_INFERIOR        = 2,
  209.   GDK_NOTIFY_NONLINEAR        = 3,
  210.   GDK_NOTIFY_NONLINEAR_VIRTUAL    = 4,
  211.   GDK_NOTIFY_UNKNOWN        = 5
  212. } GdkNotifyType;
  213.  
  214. /* Enter/leave event modes.
  215.  *   NotifyNormal
  216.  *   NotifyGrab
  217.  *   NotifyUngrab
  218.  */
  219. typedef enum
  220. {
  221.   GDK_CROSSING_NORMAL,
  222.   GDK_CROSSING_GRAB,
  223.   GDK_CROSSING_UNGRAB
  224. } GdkCrossingMode;
  225.  
  226. typedef enum
  227. {
  228.   GDK_PROPERTY_NEW_VALUE,
  229.   GDK_PROPERTY_DELETE
  230. } GdkPropertyState;
  231.  
  232. typedef enum
  233. {
  234.   GDK_WINDOW_STATE_WITHDRAWN  = 1 << 0,
  235.   GDK_WINDOW_STATE_ICONIFIED  = 1 << 1,
  236.   GDK_WINDOW_STATE_MAXIMIZED  = 1 << 2,
  237.   GDK_WINDOW_STATE_STICKY     = 1 << 3,
  238.   GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
  239.   GDK_WINDOW_STATE_ABOVE      = 1 << 5,
  240.   GDK_WINDOW_STATE_BELOW      = 1 << 6
  241. } GdkWindowState;
  242.  
  243. typedef enum
  244. {
  245.   GDK_SETTING_ACTION_NEW,
  246.   GDK_SETTING_ACTION_CHANGED,
  247.   GDK_SETTING_ACTION_DELETED
  248. } GdkSettingAction;
  249.  
  250. typedef enum
  251. {
  252.   GDK_OWNER_CHANGE_NEW_OWNER,
  253.   GDK_OWNER_CHANGE_DESTROY,
  254.   GDK_OWNER_CHANGE_CLOSE
  255. } GdkOwnerChange;
  256.  
  257. struct _GdkEventAny
  258. {
  259.   GdkEventType type;
  260.   GdkWindow *window;
  261.   gint8 send_event;
  262. };
  263.  
  264. struct _GdkEventExpose
  265. {
  266.   GdkEventType type;
  267.   GdkWindow *window;
  268.   gint8 send_event;
  269.   GdkRectangle area;
  270.   GdkRegion *region;
  271.   gint count; /* If non-zero, how many more events follow. */
  272. };
  273.  
  274. struct _GdkEventNoExpose
  275. {
  276.   GdkEventType type;
  277.   GdkWindow *window;
  278.   gint8 send_event;
  279. };
  280.  
  281. struct _GdkEventVisibility
  282. {
  283.   GdkEventType type;
  284.   GdkWindow *window;
  285.   gint8 send_event;
  286.   GdkVisibilityState state;
  287. };
  288.  
  289. struct _GdkEventMotion
  290. {
  291.   GdkEventType type;
  292.   GdkWindow *window;
  293.   gint8 send_event;
  294.   guint32 time;
  295.   gdouble x;
  296.   gdouble y;
  297.   gdouble *axes;
  298.   guint state;
  299.   gint16 is_hint;
  300.   GdkDevice *device;
  301.   gdouble x_root, y_root;
  302. };
  303.  
  304. struct _GdkEventButton
  305. {
  306.   GdkEventType type;
  307.   GdkWindow *window;
  308.   gint8 send_event;
  309.   guint32 time;
  310.   gdouble x;
  311.   gdouble y;
  312.   gdouble *axes;
  313.   guint state;
  314.   guint button;
  315.   GdkDevice *device;
  316.   gdouble x_root, y_root;
  317. };
  318.  
  319. struct _GdkEventScroll
  320. {
  321.   GdkEventType type;
  322.   GdkWindow *window;
  323.   gint8 send_event;
  324.   guint32 time;
  325.   gdouble x;
  326.   gdouble y;
  327.   guint state;
  328.   GdkScrollDirection direction;
  329.   GdkDevice *device;
  330.   gdouble x_root, y_root;
  331. };
  332.  
  333. struct _GdkEventKey
  334. {
  335.   GdkEventType type;
  336.   GdkWindow *window;
  337.   gint8 send_event;
  338.   guint32 time;
  339.   guint state;
  340.   guint keyval;
  341.   gint length;
  342.   gchar *string;
  343.   guint16 hardware_keycode;
  344.   guint8 group;
  345. };
  346.  
  347. struct _GdkEventCrossing
  348. {
  349.   GdkEventType type;
  350.   GdkWindow *window;
  351.   gint8 send_event;
  352.   GdkWindow *subwindow;
  353.   guint32 time;
  354.   gdouble x;
  355.   gdouble y;
  356.   gdouble x_root;
  357.   gdouble y_root;
  358.   GdkCrossingMode mode;
  359.   GdkNotifyType detail;
  360.   gboolean focus;
  361.   guint state;
  362. };
  363.  
  364. struct _GdkEventFocus
  365. {
  366.   GdkEventType type;
  367.   GdkWindow *window;
  368.   gint8 send_event;
  369.   gint16 in;
  370. };
  371.  
  372. struct _GdkEventConfigure
  373. {
  374.   GdkEventType type;
  375.   GdkWindow *window;
  376.   gint8 send_event;
  377.   gint x, y;
  378.   gint width;
  379.   gint height;
  380. };
  381.  
  382. struct _GdkEventProperty
  383. {
  384.   GdkEventType type;
  385.   GdkWindow *window;
  386.   gint8 send_event;
  387.   GdkAtom atom;
  388.   guint32 time;
  389.   guint state;
  390. };
  391.  
  392. struct _GdkEventSelection
  393. {
  394.   GdkEventType type;
  395.   GdkWindow *window;
  396.   gint8 send_event;
  397.   GdkAtom selection;
  398.   GdkAtom target;
  399.   GdkAtom property;
  400.   guint32 time;
  401.   GdkNativeWindow requestor;
  402. };
  403.  
  404. struct _GdkEventOwnerChange
  405. {
  406.   GdkEventType type;
  407.   GdkWindow *window;
  408.   gint8 send_event;
  409.   GdkNativeWindow owner;
  410.   GdkOwnerChange reason;
  411.   GdkAtom selection;
  412.   guint32 time;
  413.   guint32 selection_time;
  414. };
  415.  
  416. /* This event type will be used pretty rarely. It only is important
  417.    for XInput aware programs that are drawing their own cursor */
  418.  
  419. struct _GdkEventProximity
  420. {
  421.   GdkEventType type;
  422.   GdkWindow *window;
  423.   gint8 send_event;
  424.   guint32 time;
  425.   GdkDevice *device;
  426. };
  427.  
  428. struct _GdkEventClient
  429. {
  430.   GdkEventType type;
  431.   GdkWindow *window;
  432.   gint8 send_event;
  433.   GdkAtom message_type;
  434.   gushort data_format;
  435.   union {
  436.     char b[20];
  437.     short s[10];
  438.     long l[5];
  439.   } data;
  440. };
  441.  
  442. struct _GdkEventSetting
  443. {
  444.   GdkEventType type;
  445.   GdkWindow *window;
  446.   gint8 send_event;
  447.   GdkSettingAction action;
  448.   char *name;
  449. };
  450.  
  451. struct _GdkEventWindowState
  452. {
  453.   GdkEventType type;
  454.   GdkWindow *window;
  455.   gint8 send_event;
  456.   GdkWindowState changed_mask;
  457.   GdkWindowState new_window_state;
  458. };
  459.  
  460. struct _GdkEventGrabBroken {
  461.   GdkEventType type;
  462.   GdkWindow *window;
  463.   gint8 send_event;
  464.   gboolean keyboard;
  465.   gboolean implicit;
  466.   GdkWindow *grab_window;
  467. };
  468.  
  469. /* Event types for DND */
  470.  
  471. struct _GdkEventDND {
  472.   GdkEventType type;
  473.   GdkWindow *window;
  474.   gint8 send_event;
  475.   GdkDragContext *context;
  476.  
  477.   guint32 time;
  478.   gshort x_root, y_root;
  479. };
  480.  
  481. union _GdkEvent
  482. {
  483.   GdkEventType            type;
  484.   GdkEventAny            any;
  485.   GdkEventExpose        expose;
  486.   GdkEventNoExpose        no_expose;
  487.   GdkEventVisibility        visibility;
  488.   GdkEventMotion        motion;
  489.   GdkEventButton        button;
  490.   GdkEventScroll            scroll;
  491.   GdkEventKey            key;
  492.   GdkEventCrossing        crossing;
  493.   GdkEventFocus            focus_change;
  494.   GdkEventConfigure        configure;
  495.   GdkEventProperty        property;
  496.   GdkEventSelection        selection;
  497.   GdkEventOwnerChange          owner_change;
  498.   GdkEventProximity        proximity;
  499.   GdkEventClient        client;
  500.   GdkEventDND               dnd;
  501.   GdkEventWindowState       window_state;
  502.   GdkEventSetting           setting;
  503.   GdkEventGrabBroken        grab_broken;
  504. };
  505.  
  506. GType     gdk_event_get_type            (void) G_GNUC_CONST;
  507.  
  508. gboolean  gdk_events_pending         (void);
  509. GdkEvent* gdk_event_get            (void);
  510.  
  511. GdkEvent* gdk_event_peek                (void);
  512. GdkEvent* gdk_event_get_graphics_expose (GdkWindow     *window);
  513. void      gdk_event_put             (GdkEvent      *event);
  514.  
  515. GdkEvent* gdk_event_new                 (GdkEventType    type);
  516. GdkEvent* gdk_event_copy             (GdkEvent     *event);
  517. void      gdk_event_free             (GdkEvent     *event);
  518.  
  519. guint32   gdk_event_get_time            (GdkEvent        *event);
  520. gboolean  gdk_event_get_state           (GdkEvent        *event,
  521.                                          GdkModifierType *state);
  522. gboolean  gdk_event_get_coords        (GdkEvent     *event,
  523.                      gdouble     *x_win,
  524.                      gdouble     *y_win);
  525. gboolean  gdk_event_get_root_coords    (GdkEvent     *event,
  526.                      gdouble     *x_root,
  527.                      gdouble     *y_root);
  528. gboolean  gdk_event_get_axis            (GdkEvent        *event,
  529.                                          GdkAxisUse       axis_use,
  530.                                          gdouble         *value);
  531. void      gdk_event_handler_set     (GdkEventFunc    func,
  532.                      gpointer        data,
  533.                      GDestroyNotify  notify);
  534.  
  535. void       gdk_event_set_screen (GdkEvent  *event,
  536.                  GdkScreen *screen);
  537. GdkScreen *gdk_event_get_screen (GdkEvent  *event);
  538.  
  539. void      gdk_set_show_events        (gboolean     show_events);
  540. gboolean  gdk_get_show_events        (void);
  541.  
  542. #ifndef GDK_MULTIHEAD_SAFE
  543. void gdk_add_client_message_filter (GdkAtom       message_type,
  544.                     GdkFilterFunc func,
  545.                     gpointer      data);
  546.  
  547. gboolean gdk_setting_get (const gchar *name,
  548.               GValue      *value); 
  549. #endif /* GDK_MULTIHEAD_SAFE */
  550.  
  551. G_END_DECLS
  552.  
  553. #endif /* __GDK_EVENTS_H__ */
  554.